class Payment:
  def pay(self, price):   # 父类里应该定义好要传的形参
    pass


class PayPalPayment(Payment):
  def __init__(self, paypal_no, money):
    self.paypal_no = paypal_no
    self.money = money

  def pay(self, price):
    print("欢迎使用大陆贝宝余额支付")
    self.money -= price
    return self.money


class CreditPayment(Payment):
  def __init__(self, card_no, money):
    self.card_no = card_no
    self.money = money

  def pay(self, price):
    print("欢迎使用信用卡支付")
    self.money -= price
    return self.money

p1 = PayPalPayment("1234", 4000)
p2 = CreditPayment("897", 100)

pay = [p1, p2]
for i in pay:
  i.pay(23)
  print(f"余额{i.money}")
